import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import render from '@dfeidao/atom-web/render/render';
import fire from '@dfeidao/atom-web/msg/fire';
import p001 from './p001';
import p002 from './p002';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import set from '@dfeidao/atom-web/local/set';
// import get from '@dfeidao/atom-web/local/get';

export default async function a006(fd: IFeidaoAiBrowserComponent) {
	// todo
	const res = await nodejs<Array<{ equip_type_no: string; equip_type_name: string }>>('device-type/zj-000004/s001', {
		filter: {
			equip_type_name: ''
		}
	});
	console.log(res[0].equip_type_name);
	render(fd, res, p001, 'p001', 'inner');
	render(fd, res, p002, 'p002', 'inner');
	//获取表中第一条数据的编号
	const resno = res[0].equip_type_no
	//调用组件5的数据显示（根据传入的编号）
	fire('zj-000005', 'a001', resno, res[0].equip_type_name);
	fire('zj-000009', 'a004', resno);
	set(fd, 'resno', resno);

}
